package io;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class ReadFromProcess {

    public static void main(String[] args) throws Exception {
        //Runtime的exec方法可以运行平台上的其他程序
        Process p = Runtime.getRuntime().exec("javac");
        BufferedReader br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
        String buff = null;
        while ((buff = br.readLine()) != null) {
            System.out.println(buff);
        }
        br.close();

    }
}
